[commands] Rename deadlineWith to deadlineFor (#6544)

Deprecate deadlineWith for backwards compatibility.
This commit is contained in:
Isaac Turner
2024-04-29 03:02:29 +08:00
committed by GitHub
parent 1ec089c7f9
commit 67fe11f9cd
4 changed files with 44 additions and 2 deletions

View File

@@ -287,11 +287,32 @@ public abstract class Command implements Sendable {
*
* @param parallel the commands to run in parallel
* @return the decorated command
* @deprecated Use {@link deadlineFor} instead.
*/
@Deprecated(since = "2025", forRemoval = true)
public ParallelDeadlineGroup deadlineWith(Command... parallel) {
return new ParallelDeadlineGroup(this, parallel);
}
/**
* Decorates this command with a set of commands to run parallel to it, ending when the calling
* command ends and interrupting all the others. Often more convenient/less-verbose than
* constructing a new {@link ParallelDeadlineGroup} explicitly.
*
* <p>Note: This decorator works by adding this command to a composition. The command the
* decorator was called on cannot be scheduled independently or be added to a different
* composition (namely, decorators), unless it is manually cleared from the list of composed
* commands with {@link CommandScheduler#removeComposedCommand(Command)}. The command composition
* returned from this method can be further decorated without issue.
*
* @param parallel the commands to run in parallel. Note the parallel commands will be interupted
* when the deadline command ends
* @return the decorated command
*/
public ParallelDeadlineGroup deadlineFor(Command... parallel) {
return new ParallelDeadlineGroup(this, parallel);
}
/**
* Decorates this command with a set of commands to run parallel to it, ending when the last
* command ends. Often more convenient/less-verbose than constructing a new {@link