Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Simplify command dispatch to ensure command order (#2131)
Dieser Commit ist enthalten in:
Ursprung
5cd9616507
Commit
86acb1c4d4
@ -678,20 +678,16 @@ public final class PlatformCommandManager {
|
|||||||
|
|
||||||
Actor actor = event.getActor();
|
Actor actor = event.getActor();
|
||||||
String args = event.getArguments();
|
String args = event.getArguments();
|
||||||
TaskManager.taskManager().taskNow(() -> {
|
|
||||||
if (!Fawe.isMainThread()) {
|
|
||||||
Thread.currentThread().setName("FAWE Thread for player: " + actor.getName());
|
|
||||||
}
|
|
||||||
int space0 = args.indexOf(' ');
|
int space0 = args.indexOf(' ');
|
||||||
String arg0 = space0 == -1 ? args : args.substring(0, space0);
|
String arg0 = space0 == -1 ? args : args.substring(0, space0);
|
||||||
Optional<Command> optional = commandManager.getCommand(arg0);
|
Optional<Command> optional = commandManager.getCommand(arg0);
|
||||||
if (!optional.isPresent()) {
|
if (optional.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Command cmd = optional.get();
|
Command cmd = optional.get();
|
||||||
PermissionCondition queued = cmd.getCondition().as(PermissionCondition.class).orElse(null);
|
PermissionCondition queued = cmd.getCondition().as(PermissionCondition.class).orElse(null);
|
||||||
if (queued != null && !queued.isQueued()) {
|
if (queued != null && !queued.isQueued()) {
|
||||||
handleCommandOnCurrentThread(event);
|
TaskManager.taskManager().taskNow(() -> handleCommandOnCurrentThread(event), Fawe.isMainThread());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
actor.decline();
|
actor.decline();
|
||||||
@ -702,7 +698,6 @@ public final class PlatformCommandManager {
|
|||||||
PlatformCommandManager.this.handleCommandOnCurrentThread(event);
|
PlatformCommandManager.this.handleCommandOnCurrentThread(event);
|
||||||
}
|
}
|
||||||
}, false, true);
|
}, false, true);
|
||||||
}, Fawe.isMainThread());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleCommandOnCurrentThread(CommandEvent event) {
|
public void handleCommandOnCurrentThread(CommandEvent event) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren