Cancel and remove running henna tasks before restoring hennas.
This commit is contained in:
		| @@ -7798,6 +7798,17 @@ public final class PlayerInstance extends Playable | ||||
| 			_henna[i - 1] = null; | ||||
| 		} | ||||
| 		 | ||||
| 		// Cancel and remove existing running tasks. | ||||
| 		for (Entry<Integer, ScheduledFuture<?>> entry : _hennaRemoveSchedules.entrySet()) | ||||
| 		{ | ||||
| 			final ScheduledFuture<?> task = entry.getValue(); | ||||
| 			if ((task != null) && !task.isCancelled() && !task.isDone()) | ||||
| 			{ | ||||
| 				task.cancel(true); | ||||
| 			} | ||||
| 			_hennaRemoveSchedules.remove(entry.getKey()); | ||||
| 		} | ||||
| 		 | ||||
| 		try (Connection con = DatabaseFactory.getConnection(); | ||||
| 			PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS)) | ||||
| 		{ | ||||
| @@ -7833,6 +7844,8 @@ public final class PlayerInstance extends Playable | ||||
| 							removeHenna(slot); | ||||
| 							continue; | ||||
| 						} | ||||
| 						 | ||||
| 						// Add the new task. | ||||
| 						_hennaRemoveSchedules.put(slot, ThreadPool.schedule(new HennaDurationTask(this, slot), System.currentTimeMillis() + remainingTime)); | ||||
| 					} | ||||
| 					 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment