diff --git a/src/main/java/com/github/theholywaffle/teamspeak3/api/CommandFuture.java b/src/main/java/com/github/theholywaffle/teamspeak3/api/CommandFuture.java index 0d72828e..b77f70fc 100644 --- a/src/main/java/com/github/theholywaffle/teamspeak3/api/CommandFuture.java +++ b/src/main/java/com/github/theholywaffle/teamspeak3/api/CommandFuture.java @@ -512,6 +512,22 @@ public synchronized void forwardResult(final CommandFuture otherFuture) { forwardSuccess(otherFuture).forwardFailure(otherFuture); } + /** + * Returns a new {@code CommandFuture} that already has a value set. + * + * @param value + * the default value for the new {@code CommandFuture} + * @param + * the dynamic type of the value, will usually be inferred + * + * @return a new {@code CommandFuture} with a default value + */ + public static CommandFuture immediate(V value) { + final CommandFuture future = new CommandFuture<>(); + future.set(value); + return future; + } + /** * Combines multiple {@code CommandFuture}s into a single future, which will * succeed if all futures succeed and fail as soon as one future fails.