Change command manager lock handling to avoid non-fair tryLock call

This commit is contained in:
Luck 2021-03-20 15:28:45 +00:00
parent 4564a97371
commit 6b2c4bca58
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -141,11 +141,11 @@ public class CommandManager {
AtomicReference<Thread> thread = new AtomicReference<>();
CompletableFuture<CommandResult> future = CompletableFuture.supplyAsync(() -> {
thread.set(Thread.currentThread());
if (!this.lock.tryLock()) {
if (this.lock.isLocked()) {
Message.ALREADY_EXECUTING_COMMAND.send(sender);
this.lock.lock();
}
this.lock.lock();
try {
return execute(sender, label, args);
} catch (Throwable e) {