Use CompletableFuture in command invocation
This commit is contained in:
parent
cf1a715ddf
commit
784a21e257
@ -6,6 +6,7 @@
|
|||||||
package dev.salmonllama.fsbot.guthix;
|
package dev.salmonllama.fsbot.guthix;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public abstract class Command {
|
public abstract class Command {
|
||||||
public abstract String name();
|
public abstract String name();
|
||||||
@ -18,7 +19,6 @@ public abstract class Command {
|
|||||||
public abstract void onCommand(CommandContext ctx);
|
public abstract void onCommand(CommandContext ctx);
|
||||||
|
|
||||||
public void invoke(final CommandContext ctx) {
|
public void invoke(final CommandContext ctx) {
|
||||||
Thread thread = new Thread(() -> onCommand(ctx));
|
CompletableFuture.runAsync(() -> onCommand(ctx));
|
||||||
thread.start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user