mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-29 12:37:40 +01:00
Change command manager lock handling to avoid non-fair tryLock call
This commit is contained in:
parent
4564a97371
commit
6b2c4bca58
@ -141,11 +141,11 @@ public class CommandManager {
|
|||||||
AtomicReference<Thread> thread = new AtomicReference<>();
|
AtomicReference<Thread> thread = new AtomicReference<>();
|
||||||
CompletableFuture<CommandResult> future = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<CommandResult> future = CompletableFuture.supplyAsync(() -> {
|
||||||
thread.set(Thread.currentThread());
|
thread.set(Thread.currentThread());
|
||||||
if (!this.lock.tryLock()) {
|
if (this.lock.isLocked()) {
|
||||||
Message.ALREADY_EXECUTING_COMMAND.send(sender);
|
Message.ALREADY_EXECUTING_COMMAND.send(sender);
|
||||||
this.lock.lock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.lock.lock();
|
||||||
try {
|
try {
|
||||||
return execute(sender, label, args);
|
return execute(sender, label, args);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user