Tempfix for vehicle path issues.
This commit is contained in:
parent
b4def6ab92
commit
b0e918e4fe
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -54,6 +55,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
/**
|
||||
* Creates an abstract vehicle.
|
||||
@ -132,6 +135,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -162,12 +170,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ public class AirShipGludioGracia extends AbstractNpcAI implements Runnable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_BOARD_AN_AIRSHIP_WHILE_A_PET_OR_A_SERVITOR_IS_SUMMONED);
|
||||
return null;
|
||||
}
|
||||
else if (_ship.isInDock() && _ship.isInsideRadius3D(player, 600))
|
||||
else if (_ship.isInDock() && World.getInstance().getVisibleObjects(player, AirShipInstance.class).contains(_ship))
|
||||
{
|
||||
_ship.addPassenger(player);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -54,6 +55,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
/**
|
||||
* Creates an abstract vehicle.
|
||||
@ -132,6 +135,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -162,12 +170,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.threads.ThreadPool;
|
||||
@ -55,6 +56,8 @@ public abstract class Vehicle extends Creature
|
||||
|
||||
protected VehiclePathPoint[] _currentPath = null;
|
||||
protected int _runState = 0;
|
||||
private ScheduledFuture<?> _monitorTask = null;
|
||||
private final Location _monitorLocation = new Location(this);
|
||||
|
||||
public Vehicle(CreatureTemplate template)
|
||||
{
|
||||
@ -129,6 +132,11 @@ public abstract class Vehicle extends Creature
|
||||
{
|
||||
point.setHeading(point.getRotationSpeed());
|
||||
teleToLocation(point, false);
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
else
|
||||
@ -159,12 +167,44 @@ public abstract class Vehicle extends Creature
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Make sure vehicle is not stuck.
|
||||
if (_monitorTask == null)
|
||||
{
|
||||
_monitorTask = ThreadPool.scheduleAtFixedRate(() ->
|
||||
{
|
||||
if (!isInDock() && (calculateDistance3D(_monitorLocation) == 0))
|
||||
{
|
||||
if (_currentPath != null)
|
||||
{
|
||||
if (_runState < _currentPath.length)
|
||||
{
|
||||
moveToNextRoutePoint();
|
||||
}
|
||||
else
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_monitorLocation.setXYZ(this);
|
||||
}
|
||||
}, 1000, 1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_monitorTask != null)
|
||||
{
|
||||
_monitorTask.cancel(true);
|
||||
_monitorTask = null;
|
||||
}
|
||||
_currentPath = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user