2
0
Эх сурвалжийг харах

Added new function to the instance for setting return location.
Also duration is milliseconds de-facto, not minutes :)

_DS_ 15 жил өмнө
parent
commit
7fdecd10e3

+ 12 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/entity/Instance.java

@@ -124,7 +124,7 @@ public class Instance
 	
 	/**
 	 * Set the instance duration task
-	 * @param duration in minutes
+	 * @param duration in milliseconds
 	 */
 	public void setDuration(int duration)
 	{
@@ -132,6 +132,7 @@ public class Instance
 			_CheckTimeUpTask.cancel(true);
 
 		_CheckTimeUpTask = ThreadPoolManager.getInstance().scheduleGeneral(new CheckTimeUp(duration), 500);
+		_instanceEndTime = System.currentTimeMillis() + duration + 500;
 	}
 
 	/**
@@ -281,6 +282,16 @@ public class Instance
 		return _spawnLoc;
 	}
 
+	/**
+	 * Sets the spawn location for this instance to be used when leaving the instance
+	 */
+	public void setSpawnLoc(int[] loc)
+	{
+		if (loc == null || loc.length < 3)
+			return;
+		System.arraycopy(loc, 0, _spawnLoc, 0, 3);
+	}
+
 	public void removePlayers()
 	{
 		_players.forEach(_ejectProc);